package com.jack.thinking.thread.core._1;

/**
 * when thread.suspend happened, 
 * target thread will hold on MyThread.run() 's System.out.println's Lock.
 * so Main 's thread cann't get System.out.println's Lock.
 * @author wangbingwu
 *
 */
public class SuspendLockStop {
	
	@SuppressWarnings("deprecation")
	public static void main(String[] args) throws Exception {
		MyThread mt = new MyThread();
		mt.start();
		Thread.sleep(1000L);
		mt.suspend();
		System.out.println("main end!");	//can't out
	}

}

class MyThread extends Thread{
	private long i = 0;
	
	@Override
	public void run() {
		synchronized (MyThread.class) {
			while(true) {
				i++;
				System.out.println(i);
			}
		}
		
	}
}
